# -*- coding: utf-8 -*-
"""
Project: automation-api-project
Creator: jinsheng
Create time: 2021-11-26 09:03
IDE: PyCharm
Introduction: ods_device_electric_ts表造数据
"""

from common.hbaseDataOperate import HbaseOperate

hb = HbaseOperate(table_name='ods_device_electric_ts')
res = hb.query_data()
print(res[0][1])
except_list = [b'cf:indfat_origin_kwh', b'cf:indfrt_origin_kvarh', b'cf:indrat_origin_kwh', b'cf:indrrt_origin_kvarh',
               b'cf:pa_actual_kw', b'cf:pb_actual_kw', b'cf:pc_actual_kw', b'cf:pt_actual_kw', b'cf:qa_actual_kvar',
               b'cf:qb_actual_kvar', b'cf:qc_actual_kvar', b'cf:pfa_origin_empty', b'cf:pfb_origin_empty',
               b'cf:pfc_origin_empty', b'cf:pft_origin_empty', b'cf:qt_actual_kvar']
for i in except_list:
    try:
        if (res[0][1][i]).decode() == '':
            print(f"{i} 的值为空")
        else:
            print(f"{i} 的值为{(res[0][1][i]).decode()}")
    except KeyError:
        print(f'{i} 不存在')
